package com.carkeeper.order.dao;

import com.carkeeper.order.pojo.Order;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import tk.mybatis.mapper.common.Mapper;

import java.util.Date;
import java.util.List;
import java.util.Map;

public interface OrderMapper extends Mapper<Order> {
    @Select("SELECT DATE_FORMAT(create_date,'%m.%d') day, SUM(money) money FROM  tb_order WHERE create_date BETWEEN #{date} AND NOW() GROUP BY day")
    public List<Map> findMoneyByDate(@Param("date") Date date);

    @Select("SELECT DATE_FORMAT(create_date,'%m.%d') day, SUM(money) money FROM  tb_order WHERE store_name=#{storeName} and create_date BETWEEN #{date} AND NOW()  GROUP BY day")
    public List<Map> findMoneyByStore(@Param("date") Date date,@Param("storeName") String storeName);
}